<?php
   require_once('inc_admin.php'); 
  //连接数据库   
  connect();

  if(!empty($_FILES["zmh_pic"]["name"])){
    $zmh_pic = uploadfile('zmh_pic','./upload/',array('jpg','gif','png'));
  }
  else{
    $zmh_pic='';
  }

  $data = array(
    'zmh_title' => trim($_POST['zmh_title']),  
    'zmh_place' => $_POST['zmh_place'],
    'zmh_intro' => $_POST['zmh_intro'],
    'zmh_adddate' => $_POST['zmh_adddate'],
    'zmh_hint' => $_POST['zmh_hint'],
    'zmh_pic'=>$zmh_pic
    );

  //执行SQL语句
  $result = add('flower',$data);

  if(!$result){
    echo "注册失败！<br/>";
    echo "<a href='addflower.html'>返回</a>";   
  }else{    
  echo "添加成功！";
  echo "或返回<a href='flowerlist.php'>鲜花列表</a>页面！";   
  }    
  
?>

